package compiler;

import java.io.*;
import java.util.*;

public class FileManipulation {
	
	public static void makeParseFile(String src, String aux, ArrayList<String> lexicalErrorImages){
		try {
			FileReader fr = new FileReader(src);	
	        FileWriter fw  = new FileWriter(aux);
	        BufferedReader br = new BufferedReader(fr);
	        PrintWriter pw = new PrintWriter(fw);
	        String line; 
	        while ((line = br.readLine()) != null){                	
            	for(int i = 0; i < lexicalErrorImages.size(); i++){                		
            		line = line.replace(lexicalErrorImages.get(i), "");                		
            	}                	
            	pw.println(line);                	
            }
            pw.flush();
            fr.close();
            fw.close();
		} catch (FileNotFoundException e) {			
			e.printStackTrace();
		} catch (IOException e){
			e.printStackTrace();
		}
	}

}
